﻿//<TunynetCopyright>
//--------------------------------------------------------------
//<copyright>青岛拓宇网络科技有限公司 2005-2008</copyright>
//<version>V0.5</verion>
//<createdate>2008-4-9</createdate>
//<author>mazq</author>
//<email>mazq@tunynet.com</email>
//<log date="2008-4-9">创建</log>
//--------------------------------------------------------------
//</TunynetCopyright>

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Web.UI;
using System.Web.UI.WebControls;
using ChinaCustoms.Qingdao.Workflow.Supports;
using ChinaCustoms.Qingdao.Workflow.Permissions;
using ChinaCustoms.Framework.DeluxeWorks.Library.OGUPermission;
using System.Configuration;
using Tunynet.QingdaoCustoms.Utils;

namespace ChinaCustoms.Qingdao.Workflow.Controls
{
    /// <summary>
    /// 工作流意见展示控件
    /// </summary>
    [ToolboxData("<{0}:PostilList runat=server />")]
    public class PostilList : TemplatedWebControl
    {
        /// <summary>
        /// 应用程序CodeName
        /// </summary>
        private static readonly string ApplicationCodeName = ConfigurationManager.AppSettings["ApplicationCodeName"];

        /// <summary>
        /// 登录URL
        /// </summary>
        private static readonly string LoginUrl = ConfigurationManager.AppSettings["LoginUrl"];

        /// <summary>
        /// 浏览者类型
        /// </summary>
        private ViewerType? currentUserViewerType = null;

        Dictionary<Guid, SubTaskInfo> subTaskDictionary = null;
        /// <summary>
        /// 初始化
        /// </summary>
        /// <param name="e"></param>
        protected override void OnInit(EventArgs e)
        {
            if (SkinName == null)
                ExternalSkinFileName = "Skin-PostilList.ascx";
            else
                ExternalSkinFileName = SkinName;

            base.OnInit(e);
        }

        TreeView workflowTreeView;
        /// <summary>
        /// 附加子控件
        /// </summary>
        protected override void AttachChildControls()
        {
            workflowTreeView = FindControl("WorkflowTreeView") as TreeView;
            //workflowTreeView.ShowLines = true;
            workflowTreeView.ShowExpandCollapse = true;
        }

        /// <summary>
        /// 载入
        /// </summary>
        /// <param name="e"></param>
        protected override void OnLoad(EventArgs e)
        {
            //如果用户没有登录，则转向登录页面
            if (!Context.Request.IsAuthenticated)
            {
                Context.Response.Redirect(LoginUrl);
            }

            base.OnLoad(e);
            EnsureChildControls();

            if (!Page.IsPostBack)
            {
                //如果没有外部给本控件的TaskGUID赋值,再从QueryString里面判断当前的任务号
                if (this.TaskGUID == Guid.Empty)
                {
                    if (!string.IsNullOrEmpty(this.Context.Request.QueryString["TaskGuid"]))
                    {
                        try
                        {
                            this.taskGUID = new Guid(this.Context.Request.QueryString["TaskGuid"]);
                        }
                        catch
                        {
                            //Do Nothing;
                        }
                    }
                }

                if (TaskGUID == Guid.Empty)
                {
                    this.Visible = false;
                    return;
                }

                IUser currentUser = ChinaCustomsPermissionWrapper.GetUser(PermissionUtils.StripIrrespectiveCharsForLogOnName(Context.User.Identity.Name));

                RoleCollection userRolesInApplication = currentUser.Roles[ApplicationCodeName];
                if (!string.IsNullOrEmpty(this.FullViewRoleNames.Trim()))
                {
                    string[] fullViewRoleNameArray = FullViewRoleNames.Trim().ToLower().Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries);

                    foreach (IRole role in userRolesInApplication)
                    {
                        if (fullViewRoleNameArray.Contains(role.CodeName.ToLower()))
                        {
                            currentUserViewerType = ViewerType.FullViewPermission;
                            break;
                        }
                    }
                }

                if (!currentUserViewerType.HasValue)
                {
                    if (!string.IsNullOrEmpty(this.PartViewRoleNames.Trim()))
                    {
                        string[] partViewRoleNameArray = PartViewRoleNames.Trim().ToLower().Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries);

                        foreach (IRole role in userRolesInApplication)
                        {
                            if (partViewRoleNameArray.Contains(role.CodeName.ToLower()))
                            {
                                currentUserViewerType = ViewerType.PartViewPermission;
                                break;
                            }
                        }
                    }
                }


                if (!currentUserViewerType.HasValue)
                {
                    TaskActorType taskActorType = Tasks.GetTaskActorType(currentUser.LogOnName, taskGUID, out subTaskDictionary);
                    switch (taskActorType)
                    {
                        case TaskActorType.NotActor:
                            this.Visible = false;
                            return;
                        case TaskActorType.MainFlowActor:
                            currentUserViewerType = ViewerType.MainFlowActor;
                            break;
                        case TaskActorType.SubFlowActor:
                            currentUserViewerType = ViewerType.SubFlowActor;
                            break;
                    }
                }

                TaskInfo task = Tasks.GetTask(TaskGUID);
                WorkflowInstanceInfo workflowInstanceInfo = WorkflowInstances.GetWorkflow(task.WorkflowGuid);

                string endActivityCodeName = string.Empty;

                List<ActivityInstanceInfo> activites = ActivityInstances.GetActivities(task.WorkflowGuid, null);
                this.ConstructTree(workflowTreeView.Nodes, Guid.Empty, activites);
            }

        }

        private void ConstructTree(TreeNodeCollection tnc, Guid? subFlowTaskGuid, List<ActivityInstanceInfo> activites)
        {
            foreach (ActivityInstanceInfo activity in activites)
            {
                if (activity.SubTaskGuid == subFlowTaskGuid)
                {
                    TreeNode tempNode = null;
                    string subTaskOrganizationName = string.Empty;
                    if (activity.SubTaskGuid != Guid.Empty)
                    {
                        SubTaskInfo subTaskInfo = SubTasks.GetSubTask(activity.SubTaskGuid);
                        if (subTaskInfo != null)
                        {
                            subTaskOrganizationName = subTaskInfo.OrganizationName;
                        }
                    }

                    if (activity.IsSubFlow == true)
                    {
                        string activityNameDisplay = activity.ActivityName;
                        if (string.IsNullOrEmpty(subTaskOrganizationName) == false)
                        {
                            activityNameDisplay += string.Format("[{0}]", subTaskOrganizationName);
                        }

                        //获取本子流程活动的所以完成的工作项
                        List<WorkItemInfo> workItemList = WorkItems.GetAllWorkItemOfActivity(activity.ActivityGuid, WorkItemStatus.Completed);
                        if (workItemList == null)
                        {
                            workItemList = new List<WorkItemInfo>();
                        }

                        tempNode = ConstructTreeNode(activityNameDisplay, "", "", activity.ActivityGuid.ToString());
                        tnc.Add(tempNode);

                        List<SubTaskInfo> subTaskList = SubTasks.GetSubTasks(activity.ActivityGuid, null);
                        for (int i = 0; i < subTaskList.Count; i++)
                        {
                            bool isNeedAddSpaceRow = false;
                            //首先加入此子工作流上的具体工作项
                            for (int j = workItemList.Count - 1; j >= 0; j--)
                            {
                                if (workItemList[j].CreateDate < subTaskList[i].CreateDate)
                                {
                                    tempNode.ChildNodes.Add(ConstructTreeNode(workItemList[j], subTaskOrganizationName));
                                    workItemList.RemoveAt(j);
                                }
                            }

                            switch (currentUserViewerType)
                            {
                                case ViewerType.SubFlowActor:
                                    if (subTaskDictionary != null && subTaskDictionary.ContainsKey(subTaskList[i].SubTaskGuid) == false)
                                    {
                                        isNeedAddSpaceRow = false;
                                        continue;
                                    }
                                    else
                                    {
                                        this.ConstructTree(tempNode.ChildNodes, subTaskList[i].SubTaskGuid, activites);
                                        isNeedAddSpaceRow = true;
                                    }
                                    break;
                                case ViewerType.PartViewPermission:
                                    tempNode.ChildNodes.Add(new TreeNode(subTaskList[i].OrganizationName, subTaskList[i].SubTaskGuid.ToString()));
                                    isNeedAddSpaceRow = false;
                                    break;
                                case ViewerType.MainFlowActor:
                                default:
                                    this.ConstructTree(tempNode.ChildNodes, subTaskList[i].SubTaskGuid, activites);
                                    isNeedAddSpaceRow = true;
                                    break;
                            }

                            if (isNeedAddSpaceRow == true)
                            {
                                tempNode.ChildNodes.Add(new TreeNode(string.Empty));
                            }

                            subFlowStyleIndex++;
                            if (subFlowStyleIndex >= workFlowStyle.Length)
                            {
                                subFlowStyleIndex = 0;
                            }
                        }

                        //如果还有没有加入的工作项,继续添加在 各个子工作流的后面
                        for (int i = 0; i < workItemList.Count; i++)
                        {
                            tempNode.ChildNodes.Add(ConstructTreeNode(workItemList[i], subTaskOrganizationName));
                        }
                    }
                    else
                    {
                        List<WorkItemInfo> workItemList = WorkItems.GetAllWorkItemOfActivity(activity.ActivityGuid, WorkItemStatus.Completed);
                        if (workItemList != null)
                        {
                            //1.首先添加第一个意见,(这个是第一次处理时的意见)
                            if (workItemList.Count > 0)
                            {
                                tempNode = ConstructTreeNode(workItemList[0], subTaskOrganizationName);
                                tnc.Add(tempNode);
                            }

                            //2.添加 后续对各种反馈的意见,以及别人对我的意见 的反馈
                            IList<WorkItemInfo> allWorkItemList = new List<WorkItemInfo>();
                            for (int i = 0; i < workItemList.Count; i++)
                            {
                                if (workItemList[i].SubTaskGuid != Guid.Empty)
                                {
                                    if (i > 0)
                                    {
                                        if (workItemList[i].PreviousWorkItemGuid != Guid.Empty)
                                        {
                                            WorkItemInfo preWorkItemInfo = WorkItems.GetWorkItem(workItemList[i].PreviousWorkItemGuid);
                                            if (preWorkItemInfo != null && SubTasks.IsSubTask(preWorkItemInfo.SubTaskGuid, workItemList[i].SubTaskGuid))
                                            {
                                                //如果是子任务的意见,就不显示在这里了;而是要显示在子任务上.
                                            }
                                            else
                                            {
                                                allWorkItemList.Add(workItemList[i]);
                                            }
                                        }
                                    }

                                    List<WorkItemInfo> nextWorkItemList = WorkItems.GetNextWorkItems(workItemList[i].WorkItemGuid, WorkItemStatus.Completed);
                                    for (int j = 0; j < nextWorkItemList.Count; j++)
                                    {
                                        if (isDisplayPostilOnSameLevel == true)
                                        {
                                            if (SubTasks.IsSubTask(nextWorkItemList[j].SubTaskGuid, workItemList[i].SubTaskGuid))
                                            {
                                                //如果是子任务的意见,就不显示在这里了;而是要显示在子任务上.
                                            }
                                            else
                                            {
                                                allWorkItemList.Add(nextWorkItemList[j]);
                                            }
                                        }
                                        else
                                        {
                                            //在流程的相同级别上 不显示
                                            if (nextWorkItemList[j].SubTaskGuid != workItemList[i].SubTaskGuid)
                                            {
                                                if (SubTasks.IsSubTask(nextWorkItemList[j].SubTaskGuid, workItemList[i].SubTaskGuid))
                                                {
                                                    //如果是子任务的意见,就不显示在这里了;而是要显示在子任务上.
                                                }
                                                else
                                                {
                                                    allWorkItemList.Add(nextWorkItemList[j]);
                                                }
                                            }
                                        }
                                    }
                                }

                            }

                            for (int k = 0; k < allWorkItemList.Count; k++)
                            {
                                tempNode = ConstructTreeNode(allWorkItemList[k], subTaskOrganizationName, false);
                                tnc.Add(tempNode);
                            }
                        }

                        //List<WorkItemInfo> workItemList = WorkItems.GetAllWorkItemOfActivity(activity.ActivityGuid, WorkItemStatus.Completed);
                        //if (workItemList != null)
                        //{
                        //    for (int i = 0; i < workItemList.Count; i++)
                        //    {
                        //        tempNode = ConstructTreeNode(workItemList[i], subTaskOrganizationName, i > 0 ? false : true);
                        //        tnc.Add(tempNode);
                        //    }
                        //}
                    }
                }
            }
        }

        //private bool GetIsInSubTaskDictionary(SubTaskInfo subTaskInfo)
        //{
        //    if (subTaskDictionary.ContainsKey(subTaskInfo.SubTaskGuid))
        //    {
        //        return true;
        //    }
        //    else 
        //    {
        //        List<SubTaskInfo> childrenSubTaskList= SubTasks.GetSubTasksByParentSubTaskGuid(subTaskInfo.SubTaskGuid,null);
        //        if (childrenSubTaskList != null)
        //        {
        //            bool isIn = false;
        //            for (int i = 0; i < childrenSubTaskList.Count;i++ )
        //            {
        //                isIn = GetIsInSubTaskDictionary(childrenSubTaskList[i]);
        //                if (isIn == true)
        //                {
        //                    return true;
        //                }
        //            }
        //            return isIn;
        //        }
        //        else
        //        {
        //            return false;
        //        }
        //    }
        //}


        //private void BuildeTree()
        //{

        //    foreach (ActivityInstanceInfo activity in activites)
        //    {
        //        if (activity.IsSubFlow)
        //        {
        //            TreeNode subFlowActivityTreeNode = new TreeNode(activity.ActivityName);
        //            subFlowActivityTreeNode.SelectAction = TreeNodeSelectAction.Expand;
        //            workflowTreeView.Nodes.Add(subFlowActivityTreeNode);

        //            //WorkItemInfo workItemOfStartSubFlow = WorkItems.GetWorkItem(activity.ActivityGuid, 0, WorkItemType.StartSubFlow, WorkItemStatus.Completed);
        //            WorkItemInfo workItemOfStartSubFlow = WorkItems.GetWorkItem(activity.ActivityGuid, null, WorkItemStatus.Completed);
        //            if (workItemOfStartSubFlow != null)
        //            {
        //                //设置BeforSubFlowName为启动子流程的ActivityName
        //                if (!string.IsNullOrEmpty(activity.StepNameOfBeforSubFlow))
        //                    workItemOfStartSubFlow.ActivityName = activity.StepNameOfBeforSubFlow;

        //                subFlowActivityTreeNode.ChildNodes.Add(PopulateTreeNodeFromWorkItem(workItemOfStartSubFlow));
        //            }

        //            List<SubTaskInfo> rootSubFlowsOfActivity = SubTasks.GetRootSubFlowsByActivityGuid(activity.ActivityGuid);
        //            foreach (SubTaskInfo subFlow in rootSubFlowsOfActivity)
        //            {
        //                if (currentUserViewerType == ViewerType.SubFlowActor)
        //                {
        //                    if (subFlowDictionary != null && !subFlowDictionary.ContainsKey(subFlow.SubTaskGuid))
        //                        continue;
        //                }

        //                //TreeNode subFlowTreeNode = new TreeNode(string.Format("{0}({1}, {2}, {3})", subFlow.SubFlowName, subFlow.OrganizationName, subFlow.SponsorDisplayName, subFlow.CreateDate.ToString()));
        //                TreeNode subFlowTreeNode = new TreeNode(subFlow.SubTaskName, subFlow.SubTaskGuid.ToString());

        //                subFlowTreeNode.SelectAction = TreeNodeSelectAction.Expand;
        //                subFlowActivityTreeNode.ChildNodes.Add(subFlowTreeNode);

        //                //具有部分浏览权限的用户只能看到子流程概要信息
        //                if (currentUserViewerType == ViewerType.PartViewPermission)
        //                    continue;

        //                if (currentUserViewerType == ViewerType.PartViewPermission)
        //                    continue;

        //                List<SubTaskInfo> childSubFlows = SubTasks.GetChildSubFlows(subFlow.SubTaskGuid);
        //                bool childSubFlowIsComplete;
        //                if (childSubFlows != null && childSubFlows.Count > 0)
        //                    childSubFlowIsComplete = false;
        //                else
        //                    childSubFlowIsComplete = true;

        //                List<WorkItemInfo> workItemsOfSubFlow = WorkItems.GetWorkItemsOfSubFlowPath(subFlow.SubTaskGuid);
        //                foreach (WorkItemInfo workItem in workItemsOfSubFlow)
        //                {
        //                    if (!childSubFlowIsComplete && workItem.CreateDate > childSubFlows[0].CreateDate)
        //                    {
        //                        //处理ChildSubFlow节点
        //                        foreach (SubTaskInfo childSubFlow in childSubFlows)
        //                        {
        //                            if (currentUserViewerType == ViewerType.SubFlowActor)
        //                            {
        //                                if (subFlowDictionary != null && !subFlowDictionary.ContainsKey(childSubFlow.SubTaskGuid))
        //                                    continue;
        //                            }

        //                            //TreeNode childSubFlowTreeNode = new TreeNode(string.Format("{0}({1}, {2}, {3})", childSubFlow.SubFlowName, childSubFlow.OrganizationName, childSubFlow.SponsorDisplayName, childSubFlow.CreateDate.ToString()));
        //                            TreeNode childSubFlowTreeNode = new TreeNode(childSubFlow.SubTaskName, childSubFlow.SubTaskGuid.ToString());
        //                            childSubFlowTreeNode.SelectAction = TreeNodeSelectAction.Expand;
        //                            subFlowActivityTreeNode.ChildNodes.Add(childSubFlowTreeNode);

        //                            List<WorkItemInfo> workItemsOfChildSubFlow = WorkItems.GetWorkItemsOfSubFlowPath(childSubFlow.SubTaskGuid);

        //                            foreach (WorkItemInfo workItemOfChildSubFlow in workItemsOfChildSubFlow)
        //                            {
        //                                childSubFlowTreeNode.ChildNodes.Add(PopulateTreeNodeFromWorkItem(workItemOfChildSubFlow));
        //                            }

        //                            subFlowTreeNode.ChildNodes.Add(childSubFlowTreeNode);
        //                        }

        //                        childSubFlowIsComplete = true;
        //                    }

        //                    subFlowTreeNode.ChildNodes.Add(PopulateTreeNodeFromWorkItem(workItem));
        //                }

        //                //如果在foreach中没有执行，则在此执行
        //                if (!childSubFlowIsComplete)
        //                {
        //                    //处理ChildSubFlow节点
        //                    foreach (SubTaskInfo childSubFlow in childSubFlows)
        //                    {
        //                        if (currentUserViewerType == ViewerType.SubFlowActor)
        //                        {
        //                            if (subFlowDictionary != null && !subFlowDictionary.ContainsKey(childSubFlow.SubTaskGuid))
        //                                continue;
        //                        }

        //                        //TreeNode childSubFlowTreeNode = new TreeNode(string.Format("{0}({1}, {2}, {3})", childSubFlow.SubFlowName, childSubFlow.OrganizationName, childSubFlow.SponsorDisplayName, childSubFlow.CreateDate.ToString()));
        //                        TreeNode childSubFlowTreeNode = new TreeNode(childSubFlow.SubTaskName, childSubFlow.SubTaskGuid.ToString());
        //                        childSubFlowTreeNode.SelectAction = TreeNodeSelectAction.Expand;
        //                        subFlowActivityTreeNode.ChildNodes.Add(childSubFlowTreeNode);

        //                        List<WorkItemInfo> workItemsOfChildSubFlow = WorkItems.GetWorkItemsOfSubFlowPath(childSubFlow.SubTaskGuid);

        //                        foreach (WorkItemInfo workItemOfChildSubFlow in workItemsOfChildSubFlow)
        //                        {
        //                            childSubFlowTreeNode.ChildNodes.Add(PopulateTreeNodeFromWorkItem(workItemOfChildSubFlow));
        //                        }

        //                        subFlowTreeNode.ChildNodes.Add(childSubFlowTreeNode);
        //                    }

        //                    childSubFlowIsComplete = true;
        //                }

        //            }
        //        }
        //        else
        //        {
        //            WorkItemInfo workItemOfActivity = WorkItems.GetWorkItem(activity.ActivityGuid, WorkItemStatus.Completed);
        //            if (workItemOfActivity != null)
        //            {
        //                workflowTreeView.Nodes.Add(PopulateTreeNodeFromWorkItem(workItemOfActivity));
        //            }
        //        }

        //        if (activity.CodeName.Equals(endActivityCodeName, StringComparison.CurrentCultureIgnoreCase))
        //            break;
        //    }
        //}


        /// <summary>
        /// 生成WorkItem 意见及附件节点
        /// </summary>
        /// <param name="workItem">工作项</param>
        TreeNode ConstructTreeNode(WorkItemInfo workItem)
        {
            return ConstructTreeNode(workItem, string.Empty, true);
        }

        TreeNode ConstructTreeNode(WorkItemInfo workItem, bool isDisplayAcvityName)
        {
            return ConstructTreeNode(workItem, string.Empty, isDisplayAcvityName);
        }

        TreeNode ConstructTreeNode(WorkItemInfo workItem, string activityNameAppend)
        {
            return ConstructTreeNode(workItem, activityNameAppend, true);
        }

        /// <summary>
        /// 生成WorkItem 意见及附件节点
        /// </summary>
        /// <param name="workItem">工作项</param>
        TreeNode ConstructTreeNode(WorkItemInfo workItem, string activityNameAppend, bool isDisplayAcvityName)
        {
            if (workItem != null)
            {
                string postilText = workItem.Postil.Trim();
                if (string.IsNullOrEmpty(postilText))
                {
                    postilText = "<span style='color:#999'>(未填写)</span>";
                }

                string activityNameDisplay = workItem.ActivityName;
                if (string.IsNullOrEmpty(activityNameAppend) == false)
                {
                    activityNameDisplay += string.Format("[{0}]", activityNameAppend);
                }

                return ConstructTreeNode(activityNameDisplay, postilText, workItem.ExecutorDisplayName + "(" + workItem.LastUpdateDate.ToString() + ")", workItem.WorkItemGuid.ToString(), isDisplayAcvityName);
            }
            else
            {
                return null;
            }
        }

        TreeNode ConstructTreeNode(string activityName, string postilInfo, string ExecutorInfo, string nodeValue)
        {
            return ConstructTreeNode(activityName, postilInfo, ExecutorInfo, nodeValue, true);
        }

        /// <summary>
        /// 
        /// </summary>
        /// <param name="activityName"></param>
        /// <param name="postilInfo"></param>
        /// <param name="ExecutorInfo"></param>
        /// <returns></returns>
        TreeNode ConstructTreeNode(string activityName, string postilInfo, string ExecutorInfo, string nodeValue, bool isDisplayAcvityName)
        {
            TreeNode workItemTreeNode = new TreeNode();
            workItemTreeNode.SelectAction = TreeNodeSelectAction.Expand;

            if (isDisplayAcvityName == false)
            {
                activityName = string.Empty;
            }

            string styleBegin = string.Empty;
            string styleEnd = string.Empty;

            if (isUseDifferentStyleOnSubflow == true)
            {
                styleBegin = string.Format("<span style='{0}'>", workFlowStyle[subFlowStyleIndex]);

                styleEnd = "</span>";
            }

            string treeNodeText = string.Format("<table cellpadding=\"5\" cellspacing=\"0\" style=\"border-width:0;width:{0}px\"><tr><td style=\"width:20%;vertical-align:middle\">{4}{1}{5}</td><td style=\"word-break: break-all; word-wrap:break-word;\">{4}{2}{5}</td><td style=\"width:20%;vertical-align:middle\">{4}{3}{5}</td></tr></table>", this.Width, activityName, postilInfo, ExecutorInfo, styleBegin, styleEnd);
            workItemTreeNode.Text = treeNodeText;
            workItemTreeNode.Value = nodeValue;

            return workItemTreeNode;
        }

        int subFlowStyleIndex = 0;


        #region 属性

        private Guid taskGUID = Guid.Empty;
        /// <summary>
        /// 任务ID
        /// </summary>
        public Guid TaskGUID
        {
            get { return taskGUID; }
            set { taskGUID = value; }
        }

        /// <summary>
        /// 具有完整浏览权限的角色列表
        /// </summary>
        /// <remarks>多个角色之间用,(逗号)分割</remarks>
        public string FullViewRoleNames
        {
            get { return ViewState["FullViewRoleNames"] as string ?? string.Empty; }
            set { ViewState["FullViewRoleNames"] = value; }
        }

        /// <summary>
        /// 具有部分浏览权限的角色列表
        /// </summary>
        /// <remarks>多个角色之间用,(逗号)分割</remarks>
        public string PartViewRoleNames
        {
            get { return ViewState["PartViewRoleNames"] as string ?? string.Empty; }
            set { ViewState["PartViewRoleNames"] = value; }
        }

        private int width = 1000;
        /// <summary>
        /// 宽度
        /// </summary>
        public new int Width
        {
            get { return width; }
            set { width = value; }
        }

        private bool isDisplayPostilOnSameLevel = false;
        /// <summary>
        /// 是否显示同级别上的意见
        /// </summary>
        public bool IsDisplayPostilOnSameLevel
        {
            get { return isDisplayPostilOnSameLevel; }
            set { isDisplayPostilOnSameLevel = value; }
        }

        private bool isUseDifferentStyleOnSubflow= true;
        /// <summary>
        /// 是否为子流程显示不同的样式
        /// </summary>
        public bool IsUseDifferentStyleOnSubflow
        {
            get { return isUseDifferentStyleOnSubflow; }
            set { isUseDifferentStyleOnSubflow = value; }
        }

        private string[] workFlowStyle = new string[] { "color:#000000","color:#888888", "background-color:#bbbbbb", "color:bbbbbb"};
        /// <summary>
        /// 工作流的流程样式
        /// </summary>
        public string[] WorkFlowStyle
        {
            get { return workFlowStyle; }
            set { workFlowStyle = value; }
        }


        //private string postilTextCss = string.Empty;

        //public string PostilTextCss
        //{
        //    get { return postilTextCss; }
        //    set { postilTextCss = value; }
        //}

        #endregion

        /// <summary>
        /// 浏览者类型
        /// </summary>
        private enum ViewerType
        {
            FullViewPermission,
            PartViewPermission,
            MainFlowActor,
            SubFlowActor
        }
    }
}
